{include file='pub/header'/}
<title>退货详情</title>
</head>
<body>
<div class="page-container">
    <form class="form form-horizontal" method="post">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退货商品详情：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <table class="table table-border table-bordered table-bg table-hover">
                    <thead>
                    <tr class="text-c">
                        <td>商品名称</td>
                        <td>规格</td>
                        <td>价格</td>
                        <td>数量</td>
                        <td>总价</td>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach $list as $good}
                    <tr class="text-c">
                        <td>{$good.name}</td>
                        <td>{$good.prop_name}</td>
                        <td>{$good.price}</td>
                        <td>{$good.num}</td>
                        <td>{:sprintf("%.2f", $good.price*$good.num)}</td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退款类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                {if $order_refund.refund_type eq 1}
                整单
                {else/}
                部分商品
                {/if}
            </div>
        </div>
        {if $order_refund.refund_type eq 2}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退款金额：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input input-text" name="refund_money_kefu" value="{$order_refund.refund_money_kefu}">
            </div>
        </div>
        {/if}
        {if $order_refund.refund_type eq 1}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退款内容：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box">
                    <select class="select" name="refund_content">
                        <option value="1" {if $order_refund.refund_content eq 1}selected{/if}>货物+运费</option>
                        <option value="2" {if $order_refund.refund_content eq 2}selected{/if}>货物</option>
                   </select>
                </span>
            </div>
        </div>
        {/if}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退款备注：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="remarks" class="textarea">{$order_refund.remarks}</textarea>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退货地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$order_refund.refund_address}" name="refund_address" required>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退货人：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$order_refund.refund_name}" name="refund_name" required>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退货手机号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$order_refund.refund_telephone}" name="refund_telephone" required>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>收款人信息：</label>
            <div class="formControls col-xs-8 col-sm-9">
                {$order_refund.receive_info}
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退货物流单号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                {$order_refund.send_no}
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>退货状态：</label>
            <div class="formControls col-xs-8 col-sm-9">
                {if $order_refund.status eq 1}
                    退货处理中，等待退款
                {elseif $order_refund.status eq 2}
                    退货退款完成
                {else}
                    未处理
                {/if}
                {if $order_refund.is_get eq 1}
                    ，退货已收到
                {/if}
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                {if $order_refund.refund_telephone eq ""}
                <a href="javascript:;" class="btn btn-secondary radius" onclick="order_refund()"><i class="Hui-iconfont">&#xe632;</i>同意退货
                </a>
                {/if}
                {if $order_refund.is_get neq 1}
                <a href="javascript:;" class="btn btn-secondary radius" onclick="get_order('{$order_refund.id}')"><i class="Hui-iconfont">&#xe632;</i>确认收货
                </a>
                {/if}
            </div>
        </div>
    </form>
</div>
{include file="pub/footer"/}
<script>
    $(function () {
       $('form').validate({
           submitHandler:function (form) {
               $(form).ajaxSubmit(function(res){
                   layer.msg(res.msg);
               })
           }
       });
    });
    //确定退货
    function order_refund() {
        $('form').submit();
    }
    //确认收获
    function get_order(refund_id){
        $.post('{:url("getOrder")}', {refund_id:refund_id}, function (res) {
            layer.msg(res.msg);
        });
    }

</script>
</body>
</html>